const TAP_FUNC = [
    "touchstar",
    "touchmove",
    "touchend",
    "touchcancel"
]

export default class SWidget extends THREE.Sprite {
    constructor(spmt, name) {
        super(spmt);
        this.is_swidget = true;
        this.name = name || "swidget_unknow";

        this._is_touchenable = false;
    }

    /* 
    _touchstar,
    _touchmove,
    _touchend
    */

    get isTouchEnable() {
        return this._is_touchenable;
    }

    _touchstart(evt) {
    }

    _touchmove(evt) {
    }

    _touchend() {
    }

    _touchcancel() {

    }

    enable(isable) {
        this._is_touchenable = isable;
    }

    onTouch(evtname) {
        if (this._is_touchenable) return;
        if (typeof (this["_" + evtname]) == "function") {
            this["_" + evtname]();
        }
    }

    onCancel() {
        this._touchcancel();
    }
}